#pragma once
#include "simple_log.h"
#include <map>
#include <string>

class LogThread;

class SimpleLogImpl : public SimpleLog {
public:
    SimpleLogImpl();
    ~SimpleLogImpl();

    void WriteLog(const std::wstring& log);

public: // implements SimpleLog
    virtual bool Create(const std::wstring& file_name, bool overwrite, SimpleLog::SIMPLE_LOG_LEVEL level);
    virtual void SetLevel(SimpleLog::SIMPLE_LOG_LEVEL level);
    virtual void WriteLog(SimpleLog::SIMPLE_LOG_LEVEL level, const std::wstring& log);
    virtual void WriteFormatLog(SimpleLog::SIMPLE_LOG_LEVEL level, const wchar_t* format, ...);    

private:
    void Init();
    void Clean();

private:
    HANDLE file_handle_;
    std::wstring file_name_;
    SimpleLog::SIMPLE_LOG_LEVEL level_;
    std::map<SimpleLog::SIMPLE_LOG_LEVEL, std::wstring> level_name_;
};